package com.interceptor.organization;

import java.util.*;

import com.db.organization.*;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.*;

@SuppressWarnings("serial")
public class DeptJobListInterceptor extends AbstractInterceptor{
	private List<JobVO> jlist;
	private List<DeptVO> dlist;
	private DeptJobDAO orgDAO;
	
	public void setOrgDAO(DeptJobDAO orgDAO) {
		this.orgDAO = orgDAO;
	}

	@Override
	public String intercept(ActionInvocation invoc) throws Exception {
		String result = "";
		try {
			jlist = orgDAO.getJobList();
			dlist = orgDAO.getDeptList();			
			ActionContext ac = ActionContext.getContext();
			Map<String, List> orgMap = ac.getParameters();
			orgMap.put("jlist", jlist);
			orgMap.put("dlist", dlist);
			
			result = "success";
		} catch (Exception e) {
			System.out.println("DeptJobInterceptor.intercept():"+e.toString());
			result = "error";
		}
		return result;
	}
}
